<%@ page pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://www.ld.com/shield/tags" prefix="shield"%>
<%@ page trimDirectiveWhitespaces="true" %>
<fmt:setLocale value="zh_CN"/>
<%-- 权限判断 --%>
<shield:permssion type="button">
<input class="button exporttable" type="submit" name="doSearch" value="导出当前数据" style="display: none;">
<table class="tab-list shield-table-odd shield-tr-status-class">
    <tr>
        <th class="w50 taCenter">序号</th>
	    <th>登录账号</th>
	    <th>用户姓名</th>
	    <th>角色</th>
	    <th>手机号码</th>
	    <th>最后登陆时间</th>
	    <th>登陆次数</th>
	    <th>创建时间</th>
	    <th >状态</th>
        <th class="operate_icon">操作</th>
    </tr>
<c:forEach var="model" items="${pageBean.resultList }" varStatus="var">
    <tr status="${model.state }">
        <td class="taCenter">${(pageBean.currentPage -1)*pageBean.pageSize+var.count }</td>
        
	   	<td >${model.loginCode }</td>
	   	<td ><div class="clearfix"><div class="lv-huiz entryDate_plugin fl" style="display: ;" data-entrydate="${model.entryDate}"></div><div class="lv-name fl">${model.userName }</div></div></td>
	   	<td ><shield:listFieldOut value="${model.userRoles }" field="name"/></td>
	   	<td >${model.mobile }</td>
	   	<td title="登录时间：${model.lastLoginTime }登录ip:${model.lastLoginIp }" class="shieldDatetime">${model.lastLoginTime }</td>
        <td >${model.loginCount }</td>
	   	<td class="shieldDatetime">${model.createTime }</td>
		<td>
			<c:if test="${model.state == 0 }">正常</c:if>
			<c:if test="${model.state == -1 }">删除</c:if>
			<c:if test="${model.state == 2 }">停用</c:if>
			<c:if test="${model.state == 3 }">冻结</c:if>
		</td>
        <td >
        	<!-- href改为data-url,shield-icon 用来处理操作图片，show为查看update为修改，del为删除，具体可参考源码，data-icon-title【非必需】shield-icon的title --> 
            <a data-url="${ctxPathA }/system/user/show" shieldParams="{'id':'${model.id }'}" class="shieldDialog shield-icon show" viewTitle="详情" data-icon-title="查看用户信息详情" viewWidth="600"></a>
            <a data-url="${ctxPathA }/system/user/toAddOrUpdate" shieldParams="{'id':'${model.id }'}"  class="shieldDialog shield-icon update" viewTitle="修改用户信息" viewWidth="650"></a>
			<a data-url="${ctxPathA }/to/a/system/user/sysuser_updatepwd" shieldParams="{'uid':'${model.id }','lcode':'${model.loginCode }','uname':'${model.userName }'}"  class="shieldDialog" viewTitle="重置用户密码" viewWidth="400">
				<img src="${ctxPath }/images/icon/key.png?20190319105452" class="c_p" title="重置用户密码">
			</a>
			<a data-url="${ctxPathA }/system/user/toSetRoles" shieldParams="{'id':'${model.id }'}" class="shieldDialog shield-icon audit" viewTitle="分配角色" data-icon-title="分配角色"></a>
            <a data-url="${ctxPathA }/system/user/sysuser_permission" shieldParams="{'id':'${model.id }'}" class="sideToggle_plugin shield-icon " 
            	viewWidth="800"><img src="${ctxPath }/images/icon/audit_edit.png?20190319105451" class="c_p" title="用户拥有权限"></a>
	<c:if test="${model.state != 2 }">
		  	<a data-url="${ctxPathA }/system/user/disable" shieldParams="{'id':'${model.id }'}" class="shieldAjax shield-icon disable" viewTitle="确定要停用该用户吗?"></a>
	</c:if>
	<c:if test="${model.state == 2 }">
		  	<a data-url="${ctxPathA }/system/user/enable" shieldParams="{'id':'${model.id }'}" class="shieldAjax shield-icon enable" viewTitle="确定要启用该用户吗?"></a>
	</c:if>
	<!-- 是否可删除 -->
	<c:set var="checkKey" value="u_${model.id }"/>
	<c:if test="${checkDels[checkKey] }">
            <a data-url="${ctxPathA }/system/user/del" shieldParams="{'id':'${model.id }'}"  class="shieldAjax shield-icon del" viewTitle="确定要删除该条记录吗?"></a>
	</c:if>
        </td>
    </tr>
</c:forEach>
<c:if test="${empty pageBean.resultList }">
 	<!-- 无数据时展示，有数据时展示上面的列表 -->
	<tr class="nodatatr_plugin">
        <td colspan="10" class="taCenter">暂无数据</td>
    </tr>
</c:if>
</table>
</shield:permssion>
<script>
$(".exporttable").click(function(){
	var filename = "export_"+new Date().getTime();
	var table1 = $("#searchResult .tab-list")[0];
    var sheet = XLSX.utils.table_to_sheet(table1);//将一个table对象转换成一个sheet对象
    openDownloadDialog(sheet2blob(sheet), filename+'.xlsx');
});
</script>
<%@include file="/WEB-INF/view/a/include/pagination.jsp"%>